// Copyright (c) 2009 Hypirinha contributers
// This program is made available under the terms of the MIT License.
package org.hypirinha.html.codegen;

import static org.hypirinha.html.codegen.CodegenUtil.commaSeparate;

import java.util.ArrayList;
import java.util.List;

public class GeneratedInterface extends CompilationUnit {
    protected List<String> baseInterfaces = new ArrayList<String>();

    public GeneratedInterface(String packageName, String className) {
        super(packageName, className);
    }

    protected String startDeclaration() {
        return "public interface " + className + formatBaseInterfaces() + " {";
    }

    private String formatBaseInterfaces() {
        if (baseInterfaces.isEmpty()) {
            return "";
        }
        return " extends " + commaSeparate(baseInterfaces);
    }

    public void addBaseInterface(String interfaceName) {
        baseInterfaces.add(interfaceName);
    }
}
